<?php 
namespace Admin\Controller;
use Think\Controller;
	class InitializeController extends Controller{

		public function noPermissions(){
			$this->display();
		}

		 public function _initialize(){
		 	session_start();
	        // $sid = session('username');
	        // //判断用户是否登陆
	        // if(!isset($sid)) {
	        //     redirect(U('Login/index'));
	        // }
	        if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
	        	$this->redirect('Admin/Login/index');
	        }

	        /**
	         * RBAC的权限验证,不包括Auth
	         */
	        if (!isset($_SESSION['validation'])) {
	        	if (C('USER_AUTH_ON')) {
		        	$rbac = new \Org\Util\Rbac;
		        	if (!$rbac->AccessDecision()) {
		        		include './Application/Admin/View/Index/noPermissions.html';
		        		die();
		        	}
		        }
	        }

    	}
	}
 ?>
